/**
 * 
 */
package com.java.test.user.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author 提款渠道
 *
 */
public class DrawingChannelInfo implements RowMapper<DrawingChannelInfo> {

	// 主键
	private int id;

	// 排序
	private int sort;

	// 渠道名称
	private String channelName;

	// 图片
	private String imgUrl;

	// 提款类型
	private int drawingTypeId;

	// 提款类型名称
	private String drawingTypeName;

	// 添加时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime addTime;

	private String addPeople;

	// 备注
	private String content;

	public String getAddPeople() {
		return addPeople;
	}

	public void setAddPeople(String addPeople) {
		this.addPeople = addPeople;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}

	public String getChannelName() {
		return channelName;
	}

	public void setChannelName(String channelName) {
		this.channelName = channelName;
	}

	public String getImgUrl() {
		return imgUrl;
	}

	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}

	public int getDrawingTypeId() {
		return drawingTypeId;
	}

	public void setDrawingTypeId(int drawingTypeId) {
		this.drawingTypeId = drawingTypeId;
	}

	public String getDrawingTypeName() {
		return drawingTypeName;
	}

	public void setDrawingTypeName(String drawingTypeName) {
		this.drawingTypeName = drawingTypeName;
	}

	public LocalDateTime getAddTime() {
		return addTime;
	}

	public void setAddTime(LocalDateTime addTime) {
		this.addTime = addTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Override
	public DrawingChannelInfo mapRow(ResultSet rs, int rowNum) throws SQLException {

		DrawingChannelInfo info = new DrawingChannelInfo();

		info.setId(rs.getInt("id"));
		info.setSort(rs.getInt("sort"));
		info.setImgUrl(rs.getString("img_url"));
		info.setAddTime(rs.getTimestamp("add_time") == null ? null
				: rs.getTimestamp("add_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setChannelName(rs.getString("channel_name"));
		info.setContent(rs.getString("content"));
		info.setDrawingTypeId(rs.getInt("drawing_typeid"));
		info.setAddPeople(rs.getString("add_people"));

		return info;
	}

}
